<?

//conect to mysql
$db = mysql_connect("localhost", "usr_2012_16", "se09member");
if (!$db) {
	print "Error - Could not connect to MySQL";
	exit;
}
// Select the database
$er = mysql_select_db("db_2012_16");
if (!$er) {
	print "Error - Could not select the database db_2012_16";
	exit;
}

$id = $HTTP_RAW_POST_DATA;

$query_meta = "select * from se_exercise_meta where id = $id;";
$meta = mysql_query($query_meta);
$row_meta = mysql_fetch_array($meta);
print $row_meta['title']."\n";
print $row_meta['description']."\n";

$query_content = "select content from se_exercise_content where exercise_id = $id order by line_number;";
$content = mysql_query($query_content);        
while ($row_content = mysql_fetch_array($content)) {
    print $row_content['content']."\n";
}
?>
